# Author:	gong_libin
# Date:		2016_06_01

CC = g++
CFLAGS = -g -Wall
#CFLAGS += -D_GLB_DEBUG_

GLB_ENV = $(shell pwd)
GLB_BIN = $(GLB_ENV)/bin
GLB_INC = $(GLB_ENV)/inc
GLB_SRC = $(GLB_ENV)/src
GLB_UTL = $(GLB_ENV)/util
GLB_TST = $(GLB_ENV)/test
GLB_TOL = $(GLB_ENV)/tool

GLB_PLIB = /usr/lib
GLB_PINC = /usr/include/GlbInc

GLB_RLIB = /usr/local/lib
GLB_RINC = /usr/local/include/hiredis

GLB_XINC = /usr/include/libxml2
GLB_XLIB = `xml2-config --cflags --libs`

export CC
export CFLAGS

export GLB_ENV
export GLB_BIN
export GLB_INC
export GLB_SRC
export GLB_UTL
export GLB_TST
export GLB_TOL

export GLB_PLIB
export GLB_PINC
export GLB_RLIB
export GLB_RINC
export GLB_XLIB
export GLB_XINC

.PHONY: bin util test tool src

all: bin util test tool src

bin:
	if test -d $(GLB_BIN); then true; else mkdir $(GLB_BIN); fi;

util:
	$(MAKE) -C util

test:
	$(MAKE) -C test

tool:
	$(MAKE) -C tool

src:
	$(MAKE) -C src

clean:
	$(MAKE) clean -C util
	$(MAKE) clean -C test
	$(MAKE) clean -C tool
	$(MAKE) clean -C src
	rm -rf $(GLB_BIN)
